/**
 * VUEshop
 * ============================================================================
 * * 版权所有 2015-2027 深圳搜豹网络科技有限公司，并保留所有权利。
 * 网站地址: http://www.vueshop.com.cn
 * ----------------------------------------------------------------------------
 * 这不是一个自由软件！您只能在不用于商业目的的前提下对程序代码进行修改和使用 .
 * 不允许对程序代码以任何形式任何目的的再发布。
 * ============================================================================
 * $Author: soubao-java 2020-07-22 $
 */<template>
  <div>
    <div
      id="explanation"
      class="explanation"
      style="color: rgb(85, 85, 85); background-color: rgb(243, 244, 244); width: 98%; height: 100%;"
    >
      <div class="bckopa-tips">
        <div class="title">
          <img src="@/static/images/handd.png" alt />
          <h4 title="提示相关设置操作时应注意的要点">操作提示</h4>
        </div>
        <ul>
          <li>最高手续费不应高于最高提现金额</li>
        </ul>
      </div>
      <span title="收起提示" id="explanationZoom" style="display: block;"></span>
    </div>

    <el-form ref="form" :model="form" label-width="200px" label-position="right">
      <el-form-item label="提现配置">
        <el-switch v-model="form.cash_open" active-value="1" inactive-value="0"></el-switch>
      </el-form-item>
      <el-form-item label="手续费比例(%)">
        <el-input v-model="form.service_ratio" size="mini"></el-input>
        <p class="notic">（注：默认是百分比，如填1就是 代表每笔提现，收取提现金额1%的手续费）</p>
      </el-form-item>
      <el-form-item label="最低手续费">
        <el-input v-model="form.min_service_money" size="mini"></el-input>
        <p class="notic">（注：单笔手续费计算出来小于该值时，则取该值）</p>
      </el-form-item>
      <el-form-item label="最高手续费">
        <el-input v-model="form.max_service_money" size="mini"></el-input>
        <p class="notic">（注：单笔手续费计算出来大于该值时，则取该值,为0时则不限）</p>
      </el-form-item>
      <el-form-item label="最低提现额">
        <el-input v-model="form.min_cash" size="mini"></el-input>
        <p class="notic">（注：单笔最低提现额）</p>
      </el-form-item>
      <el-form-item label="最高提现额">
        <el-input v-model="form.max_cash" size="mini"></el-input>
        <p class="notic">（注：单笔最高提现额,,为0时则不限）</p>
      </el-form-item>
      <el-form-item label="每日累计提现额">
        <el-input v-model="form.count_cash" size="mini"></el-input>
        <p class="notic">（注：单人每日累计提现额达到该值时，本日将不支持继续提现,为0时则不限）</p>
      </el-form-item>
      <el-form-item label="每日累计提现次数">
        <el-input v-model="form.cash_times" size="mini"></el-input>
        <p class="notic">（注：单人每日累计提现次数达到该值时，本日将不支持继续提现,为0时则不限）</p>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit" :loading="subLoading">确认提交</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
	import {
		getConfigs,updateConfigs
	} from "@/utils/api"
export default {
  data() {
    return {
      form: {},
	  subLoading: false,
    };
  },
  components: {},
  created() {
    this.getConfigs();
  },
  methods: {
    getConfigs() {
      var that = this;
      getConfigs({inc_type: "cash"}).then(function(res) {
          that.form = res.cash;
        });
    },
    onSubmit() {
      var that = this;
	  that.subLoading = true
      updateConfigs('cash', that.form).then(function(res) {
		  that.subLoading = false
        if (res.status == 1) {
          that.$message({
            message: "保存成功",
            type: "success"
          });
        } else {
          that.$message({
            showClose: true,
            message: "保存失败,失败原因:" + res.msg,
            type: "error"
          });
        }
      });
    }
  }
};
</script>
<style scoped>
	>>>.el-input--mini .el-input__inner {
		width: 200px;
	}
</style>
